/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package e.z.blog.back.action.base;

import e.z.blog.back.action.AbstractAction;
import e.z.blog.back.com.ComNavTreeApi;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.Mvcs;
import org.nutz.mvc.adaptor.JsonAdaptor;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import z.h.w.jar.data.tree.ReferTree;

/**
 * 2012.02.21
 *
 * @author EnzoZhong
 */
@IocBean
@At( "" )
public class BackIndex extends AbstractAction {

        @Inject
        private ComNavTreeApi comNavTree;

        @At( "/index" )
        @Ok( "jsp:back.index" )
        @Override
        public Map<String , Object> page ( HttpServletRequest req ) {
                Map<String , Object> map = this.createMap( req , "" );
                return map;
        }

        /**
         *
         */
        @At( "/progress" )
        @Ok( "raw:progress.html" )
        public void age () {
        }

        /**
         * 获取整个系统的所有url连接，权限系统完成后该方法取消，实现动态分发url资源和
         *
         * 目录资源。2012.02.21
         * <p/>
         * @return
         */
        @Ok( "json" )
        @At( "/getNavTree" )
        @AdaptBy( type = JsonAdaptor.class )
        public Collection<Map> navTree () {
                ReferTree<Map<String , String>> tree = comNavTree.getNavTree();
                return tree.getList();
        }
}
